package com.yf.zzmusic.service.impl;

import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.yf.zzmusic.pojo.vo.sms.SmsVo;
import com.yf.zzmusic.service.ISmsService;
import com.yf.zzmusic.utils.SendSms;

public class SmsService implements ISmsService {
  @Override
  public SmsVo sendSmsService(String phone) {
    SmsVo smsVo=new SmsVo();
    int code = (int) ((Math.random() * 9 + 1) * 1000);
    SendSmsResponse sendSmsResponse=SendSms.sendMessage(phone,code);
    System.out.println(sendSmsResponse.getRequestId());
    if (sendSmsResponse.getRequestId()!=null){
      smsVo.setCode(code);
      smsVo.setPhone(phone);
      return smsVo;
    }else {
      return null;
    }


  }
}
